#ifndef __SPEED_TEST_H__
#define __SPEED_TEST_H__


#include <unistd.h>
#include <pthread.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <string.h>
#include <stdlib.h>
#include <poll.h>
#include <signal.h>
#include <sys/time.h>


#define SYSFS_IO_EXPORT			"/sys/class/gpio/export"
#define SYSFS_21_EXPORT_VAL		"21"
#define SYSFS_21_DIR			"/sys/class/gpio/gpio21/direction"
#define SYSFS_IO_DIR_VAL		"in"
#define SYSFS_21_VAL			"/sys/class/gpio/gpio21/value"
#define SYSFS_21_EDGE			"/sys/class/gpio/gpio21/edge"
#define SYSFS_IO_EDGE_VAL		"rising"

#define SYSFS_18_EXPORT_VAL		"18"
#define SYSFS_18_DIR			"/sys/class/gpio/gpio18/direction"
#define SYSFS_18_VAL			"/sys/class/gpio/gpio18/value"
#define SYSFS_18_EDGE			"/sys/class/gpio/gpio18/edge"

void* start_receive_gpio_rising_thread(void *args);
int get_gpio21_rev_speed(void);
int get_gpio18_rev_speed(void);
class rotate_speed_c
{
public:
	rotate_speed_c();
	~rotate_speed_c();
	
	int setup(void);
	void exit(void);
	int init_gpio(void);
	void receive_gpio_rising_thread_func(void);

	int gpio21_fd;
	int gpio18_fd;
	struct pollfd fds[2];
	int rising_io21_count;
	int rising_io18_count;
	pthread_t speed_test_tid;
};

#endif

